const BoardControllerClass = require('../../project/campus/controller/board_controller');

// 实例化一次，后续可优化为每次请求新建实例以支持用户上下文
const boardController = new BoardControllerClass();

module.exports = {
  // 列表查询
  list: async (req, res) => {
    try {
      // 这里可根据实际需要设置 userId、参数等
      boardController._userId = req.headers['x-user-id'] || '';
      // 适配 validateData 方法，直接传递 req.query
      boardController.validateData = () => req.query;
      const result = await boardController.getBoardList();
      res.json({ code: 0, data: result });
    } catch (err) {
      res.status(500).json({ code: 1, msg: err.message });
    }
  },
  // 你可以继续添加其他方法，如 add、detail、edit、delete 等
}; 